#!/usr/bin/env python

import paho.mqtt.client as mqtt

mqttc = mqtt.Client("01-will-set")

run = -1
mqttc.will_set("topic/on/unexpected/disconnect", "will message", 1, True)
mqttc.connect("localhost", 1888)
while run == -1:
    mqttc.loop()

exit(run)
